package com.xiaobai.zhuangxiuguanjia.model;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/17 0017.
 */
public class ReadRespense {
    private String version;
    private String action;
    private int errorCode;
    private int allRows;
    private List<ReadData> readDataList;
    public void parseJSON(JSONObject json){
        version = json.optString("version");
        action = json.optString("action");
        errorCode = json.optInt("errorCode");
        allRows = json.optInt("0");
        JSONArray datas = json.optJSONArray("data");
        readDataList = new ArrayList<ReadData>();
        for (int i = 0; i < datas.length(); i++) {
            JSONObject jsonObject = datas.optJSONObject(i);
            ReadData readData = new ReadData();
            readData.parseJSON(jsonObject);
            readDataList.add(readData);
        }
    }

    public String getVersion() {
        return version;
    }

    public String getAction() {
        return action;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public int getAllRows() {
        return allRows;
    }

    public List<ReadData> getReadDataList() {
        return readDataList;
    }
}
